package com.xipu.yygh.manage.controller;

import com.xipu.yygh.common.result.R;
import com.xipu.yygh.manage.service.DepartmentService;
import com.xipu.yygh.vo.hosp.DepartmentVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * description: 科室Controller
 * @author: gql
 * @date: 2022/05
 */
@RequestMapping("/admin/hosp/department")
@RestController
public class DepartmentController {
    @Autowired
    private DepartmentService departmentService;

    /**
     * 根据医院编号查询所有科室
     * @param hoscode 医院编号
     * @return r
     */
    @GetMapping("getDeptList/{hoscode}")
    public R getDeptList(@PathVariable("hoscode") String hoscode) {
        List<DepartmentVo> list = this.departmentService.findDeptTree(hoscode);
        return R.ok().data("list", list);
    }
}
